<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>商户后台登录</title>
	<link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link rel="stylesheet" href="__PUBLIC__/admin/css/admin_login.css">
</head>
<style>
	.form-control{
		border-radius:0;
	}
	.form-input{
		height: 2.5rem;
	}
</style>
<body >
<div class="layout" style="background-image: url('https://dn-coding-net-production-static.qbox.me/84701384-aeb5-4d57-b0bd-821bbd3627d6.jpg');!important;">
	<div class="main-cont" >
		<div class="form-group">
			<input type="text" autocomplete="off"  name="" id="account" placeholder="请输入账号" class="form-input">
		</div>
		<div class="form-group">
			<input type="text" autocomplete="new-password" id="new_pwd"  placeholder="请输入新密码" class="form-input">
		</div>
		<div id="display">
			<div class="form-group">
				<input type="text" autocomplete="off" id="img_verify"  class="form-control"  placeholder="验证码" required="" style="width:40%;float:left;height: 2.5rem" >
				<img id="verifyImg" src="__MODULE__/Login/mk_verify" onclick="this.src='__MODULE__/Login/mk_verify/s/'+Math.random()" style="width:60%;height: 2.5rem;border-radius:3px;margin-top: 0.5px" />
			</div>
			<div class="form-group">
				<input type="number" id="verify" autocomplete="off" class="form-control"  placeholder="验证码" required="" style="width:66%;float:left" ><a class="btn btn-success" href="javascript:void(0);"  onclick="send_verify()" id="num" style="width:33%;padding: 6px 12px;"  >发送验证码</a>
			</div>
		</div>

		<div class="form-login">
			<div class="loginbtn" id="sure_sub">确认提交</div>
		</div>
	</div>
</div>
</body>
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>

<script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
<script>

	$('#sure_sub').on('click', function(){
		var account=$('#account').val();
		var new_pwd=$('#new_pwd').val();
		var verify=$('#verify').val()==''?'':$('#verify').val();
		var tourl="__MODULE__/Login/login";
		layer.confirm('是否确定提交？',function(){
			layer.load(2);
			$.post('__MODULE__/Login/forget_password',{account:account,new_pwd:new_pwd,verify:verify},function(data){
				layer.closeAll();
				console.log(data);
				if(data.code=='1001'){
					layer.msg(data.result,{time:2000,icon:1},function(){
						parent.layer.closeAll();
					});
				}else{
					layer.msg(data.result,{time:2000,icon:5});
				}
			});
		});
	})
	function send_verify(){
		var account=$('#account').val();
		var img_verify=$('#img_verify').val();
		layer.load(2);
		$.post('__MODULE__/Login/send_verify',{account:account,img_verify:img_verify},function(data){
			layer.closeAll();
			if(data.code=='1001'){
				layer.msg(data.result,{time:1000,icon:6});
				$('#num').attr('onclick',null);
				$('#num').html('180');
				s=setInterval('set_time()',1000);
			}else{
				$('#verifyImg').attr('src','__MODULE__/Login/mk_verify/s/'+Math.random());
				$('#img_verify').val('');
				layer.msg(data.result,{time:1000,icon:5});
			}
		});

	}
	var num=179;
	function set_time(){
		if(num>0){
			$('#num').html(num);
			num=num-1;
		}else{
			num=179;
			clearInterval(s);
			$('#num').html('发送验证码');
			$('#num').attr('onclick','send_verify()');
		}
	}
	document.onkeydown=function(event){
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if(e && e.keyCode==27){ // 按 Esc
			//要做的事情
		}
		if(e && e.keyCode==113){ // 按 F2
			//要做的事情
		}
		if(e && e.keyCode==13){ // enter 键
			$('#login_btn').click();
			//要做的事情
		}
	};


</script>
</html>